var commonService = require('../../services/common.js');
var MusicService = require('../../services/music');
var util = require('../../utils/util.js')
var app = getApp();

Page({
  data:{
    // text:"这是一个页面"
    songList: [],
    imgUrl: '',
    id: 0,
    listName: '',
    topinfo:{},
    update_time:'',
    listBgColor: ''
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    var self = this;
    var id = app.globalData.topListId;
    this.setData({
      id: id
    });
    MusicService.getTopListInfo(id, this.getTopListCallback)
  },
  getTopListCallback: function (data) {
    console.log(data);
    var imgUrl = data.topinfo.pic_album;
    this.setData({
      songlist: data.songlist,
      topinfo: data.topinfo,
      update_time: data.update_time
    });
    this.setListBgColor(data.color);
  },
  setListBgColor: function (color) {    
    var a = util.dealColor(color);

    this.setData({
      listBgColor: a
    });
  }
})